1 Public Class FrmPURCHASEORDER
2
3 Private Sub FrmPURCHASEORDER_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
4 Dim i As Integer
5 If rbpurchase.Checked Then
6 For i = 0 To listorder.Items.Count - 1
7 'MsgBox(listorder.Items(i).SubItems(4).Text)
8 If listorder.Items(i).SubItems(4).Text = "No" Then
9 listorder.Items(i).ForeColor = Color.Brown
10 ' Else
11 ' listorder.Items(i).ForeColor = Color.Black
12 End If
13 Next
14 End If
15 End Sub
16
17 Private Sub FrmPURCHASEORDER_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
18 MDIDISABLED()
19 End Sub
20
21 Private Sub FrmPURCHASEORDER_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
22 If rbpurchase.Checked Then
23 sqlSTR = "SELECT Purchase_ID as 'Purchase ID', TBL_Suppliers.SuppName as 'Supplier Name', Delivery_Term as 'Delivery Term', Purchased_Date as 'Purchase Date', Approved" & _
24 " FROM TBL_Purchase_Order INNER JOIN TBL_Suppliers ON TBL_Purchase_Order.Supp_ID = TBL_Suppliers.Supp_ID " & _
25 " WHERE TBL_Purchase_Order.Purchased_Date ='" & Format(Now, "MM/dd/yyyy") & "'" & _
26 " ORDER BY Purchase_ID"
27 FillListView(ExecuteSQLQuery(sqlSTR), listorder, 0)
28
29 Dim i As Integer
30 If rbpurchase.Checked Then
31 For i = 0 To listorder.Items.Count - 1
32 'MsgBox(listorder.Items(i).SubItems(4).Text)
33 If listorder.Items(i).SubItems(4).Text = "Yes" Then
34 listorder.Items(i).ForeColor = Color.Brown
35 Else
36 listorder.Items(i).ForeColor = Color.Black
37 End If
38 Next
39 End If
40 MDIREFRESH()
41 End If
42 Audit_Trail(xUser_ID, TimeOfDay, "View Products Purchasing Order and Receive Form")
43 End Sub
44
45 Private Sub rbName_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
46 txtname.Enabled = True
47 dtpurchased.Enabled = False
48 End Sub
49
50
51 Private Sub dtreceived_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpurchased.ValueChanged
52 If rbpurchase.Checked Then
53 sqlSTR = "SELECT Purchase_ID as 'ID', TBL_Suppliers.SuppName as 'Supplier Name', Delivery_Term as 'Delivery Term', Purchased_Date as 'Purchase Date', Approved" & _
54 " FROM TBL_Purchase_Order INNER JOIN TBL_Suppliers ON TBL_Purchase_Order.Supp_ID = TBL_Suppliers.Supp_ID " & _
55 " WHERE TBL_Purchase_Order.Purchased_Date ='" & Format(dtpurchased.Value, "MM/dd/yyyy") & "'" & _
56 " ORDER BY Purchase_ID"
57 FillListView(ExecuteSQLQuery(sqlSTR), listorder, 0)
58 Dim i As Integer
59 If rbpurchase.Checked Then
60 For i = 0 To listorder.Items.Count - 1
61 'MsgBox(listorder.Items(i).SubItems(4).Text)
62 If listorder.Items(i).SubItems(4).Text = "Yes" Then
63 listorder.Items(i).ForeColor = Color.Brown
64 'Else
65 ' listorder.Items(i).ForeColor = Color.Black
66 End If
67 Next
68 End If
69
70 Else
71 sqlSTR = "SELECT TBL_Purchase_Order.Purchase_ID as 'ID', Replace(Replace(TBL_Suppliers.SuppName,'$.$',''''),'$..$',',') as 'Supplier Name' " & _
72 ", Replace(Replace(TBL_Purchase_Order.Address,'$.$',''''),'$..$',',') as 'Address', TBL_Purchase_Order.Delivery_Term as 'Delivery Term' " & _
73 "FROM TBL_Purchase_Order " & _
74 "INNER JOIN TBL_Suppliers ON TBL_Purchase_Order.Supp_ID = TBL_Suppliers.Supp_ID " & _
75 "WHERE TBL_Purchase_Order.Approved = 'Yes' " & _
76 "AND TBL_Purchase_Order.Received_Date ='" & Format(dtpurchased.Value, "MM/dd/yyyy") & "'"
77 FillListView(ExecuteSQLQuery(sqlSTR), listorder, 0)
78 End If
79
80
81
82 End Sub
83
84 Private Sub CmdSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSearch.Click
85 If rbpurchase.Checked Then
86 sqlSTR = "SELECT Purchase_ID as 'ID', TBL_Suppliers.SuppName as 'Supplier Name', Delivery_Term as 'Delivery Term', Purchased_Date as 'Purchase Date', Approved" & _
87 " FROM TBL_Purchase_Order INNER JOIN TBL_Suppliers ON TBL_Purchase_Order.Supp_ID = TBL_Suppliers.Supp_ID " & _
88 " WHERE TBL_Suppliers.SuppName LIKE '%" & txtname.Text & "%'" & _
89 " AND TBL_Purchase_Order.Purchased_Date ='" & Format(dtpurchased.Value, "MM/dd/yyyy") & "'" & _
90 " ORDER BY Purchase_ID"
91 Else
92 sqlSTR = "SELECT DISTINCT TBL_Purchase_Order.Purchase_ID as 'ID',TBL_Suppliers.SuppName as 'Supplier Name'" & _
93 ", TBL_Purchase_Order.Address as 'Address', TBL_Purchase_Order.Delivery_Term as 'Delivery Term'" & _
94 "FROM (TBL_Purchase_Order " & _
95 "INNER JOIN TBL_Purchase_Detail ON TBL_Purchase_Order.Purchase_ID = TBL_Purchase_Detail.Purchase_ID) " & _
96 "INNER JOIN TBL_Suppliers ON TBL_Purchase_Order.Supp_ID = TBL_Suppliers.Supp_ID " & _
97 "WHERE TBL_Purchase_Order.Approved = 'Yes' " & _
98 "AND TBL_Purchase_Order.Received_Date ='" & Format(dtpurchased.Value, "MM/dd/yyyy") & "'" & _
99 " AND TBL_Suppliers.SuppName LIKE '%" & txtname.Text & "%'"
100 End If
101
102 FillListView(ExecuteSQLQuery(sqlSTR), listorder, 0)
103 grpCat.Visible = False
104 End Sub
105
106
107 Private Sub rbreceive_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbreceive.CheckedChanged
108 If rbreceive.Checked Then
109 Label3.Text = "Received Date :"
110 sqlSTR = "SELECT TBL_Purchase_Order.Purchase_ID as 'Purchase ID', TBL_Suppliers.SuppName as 'Supplier Name' " & _
111 ", Replace(Replace(TBL_Purchase_Order.Address,'$.$',''''),'$..$',',') as 'Address', TBL_Purchase_Order.Delivery_Term as 'Delivery Term' " & _
112 "FROM TBL_Purchase_Order " & _
113 "INNER JOIN TBL_Suppliers ON TBL_Purchase_Order.Supp_ID = TBL_Suppliers.Supp_ID " & _
114 "WHERE TBL_Purchase_Order.Approved = 'Yes' " & _
115 "AND TBL_Purchase_Order.Received_Date ='" & Format(dtpurchased.Value, "MM/dd/yyyy") & "'"
116 FillListView(ExecuteSQLQuery(sqlSTR), listorder, 0)
117 MDIREFRESH()
118 With MDIMain
119 .cmdNew.Enabled = False
120 .cmdEdit.Enabled = False
121 .cmdDelete.Enabled = False
122 ' .ToolStripNew.Enabled = False
123 ' .ToolStripEdit.Enabled = False
124 ' .ToolStripDelete.Enabled = False
125 End With
126 End If
127 End Sub
128
129
130 Private Sub FrmPURCHASEORDER_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
131 With Me
132 GroupBox1.Width = (.Width - (MDIMain.TSHoldRight.Width / 2)) + 60
133 GroupBox1.Height = .Height - (MDIMain.TSHoldAdvisory.Height + 45)
134 .listorder.Width = GroupBox1.Width - 10
135 .listorder.Height = GroupBox1.Height - 60
136 .dtpurchased.Left = GroupBox1.Width - .dtpurchased.Width
137 .Label3.Left = (.dtpurchased.Left - .Label3.Width) - 2
138 .rbreceive.Left = GroupBox1.Width - .rbreceive.Width - 2
139 .rbpurchase.Left = (.rbreceive.Left - .rbreceive.Width) - 10
140 End With
141 If rbreceive.Checked Then
142 MDIREFRESH()
143 With MDIMain
144 .cmdNew.Enabled = False
145 .cmdEdit.Enabled = False
146 .cmdDelete.Enabled = False
147 ' .ToolStripNew.Enabled = False
148 ' .ToolStripEdit.Enabled = False
149 ' .ToolStripDelete.Enabled = False
150 End With
151 Else
152 'MDIREFRESH()
153 End If
154 End Sub
155
156 Private Sub rbpurchase_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbpurchase.CheckedChanged
157 If rbpurchase.Checked Then
158 txtname.Enabled = False
159 dtpurchased.Enabled = True
160 Label3.Text = "Purchased Date :"
161 sqlSTR = "SELECT Purchase_ID as 'Purchase ID', TBL_Suppliers.SuppName as 'Supplier Name', Delivery_Term as 'Delivery Term', Purchased_Date as 'Purchase Date', Approved" & _
162 " FROM TBL_Purchase_Order INNER JOIN TBL_Suppliers ON TBL_Purchase_Order.Supp_ID = TBL_Suppliers.Supp_ID " & _
163 " WHERE TBL_Purchase_Order.Purchased_Date ='" & Format(dtpurchased.Value, "MM/dd/yyyy") & "'" & _
164 " ORDER BY Purchase_ID"
165
166 FillListView(ExecuteSQLQuery(sqlSTR), listorder, 0)
167 Dim i As Integer
168 If rbpurchase.Checked Then
169 For i = 0 To listorder.Items.Count - 1
170 'MsgBox(listorder.Items(i).SubItems(4).Text)
171 If listorder.Items(i).SubItems(4).Text = "Yes" Then
172 listorder.Items(i).ForeColor = Color.Brown
173 Else
174 listorder.Items(i).ForeColor = Color.Black
175 End If
176 Next
177 End If
178 MDIREFRESH()
179 End If
180 End Sub
181
182
183 Private Sub cmdcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel.Click
184 grpCat.Visible = False
185 End Sub
186
187 Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click
188
189 End Sub
190
191 Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click
192
193 End Sub
194 End Class